package com.xmy.cultivate.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.xmy.cultivate.converter.LocalDateConverter;
import com.xmy.cultivate.entity.views.RenewClassRecord;
import com.xmy.cultivate.enums.RecruitStatusEnum;
import com.xmy.cultivate.enums.StatusEnum;
import com.xmy.cultivate.enums.StatusGradeEnum;
import com.xmy.cultivate.enums.YearClassEnum;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 班级
 * </p>
 *
 * @author min
 * @since 2022-07-28
 */
@Data
public class Grade implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @ExcelIgnore
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 1精品课，2智能课，3刷题班
     */
    @ExcelIgnore
    private Integer lessonType;

    /**
     * 1手动添加，2自动添加
     */
    private Integer addType;

    /**
     * 课程id
     */
    @ExcelIgnore
    private Long courseId;

    /**
     * 班级类别(对应类别表id)
     */
    @ExcelIgnore
    private Long courseTypeId;

    @ExcelProperty(index = 1,value = "班型")
    @TableField(exist = false)
    private String courseTypeName;

    @ExcelIgnore
    private YearClassEnum yearClassId;

    /**
     * 班级名称
     */
    @ExcelProperty(index = 0,value = "班级名称")
    private String name;

    /**
     * 满班人数
     */
    @ExcelIgnore
    private Integer fullCount;

    /**
     * 每次上课学生扣除课时
     */
    @ExcelIgnore
    private Integer stuDeductHour;

    /**
     * 每次上课老师获得课时
     */
    @ExcelIgnore
    private Integer teaGainHour;

    /**
     * 招生状态（开放，满班停止，停止）对应字典表
     */
    @ExcelIgnore
    private RecruitStatusEnum recruitStatus;

    /**
     * 开班日期
     */
    @ExcelProperty(index = 6,value = "开班日期",converter = LocalDateConverter.class)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate openDate;

    /**
     * 结班日期
     */
    @ExcelIgnore
    private LocalDate endDate;

    /**
     * 上课时段开始
     */
    @ExcelIgnore
    private String timeStart;

    /**
     * 上课时段结束
     */
    @ExcelIgnore
    private String timeEnd;

    /**
     * 是否假期，0否，1是（假期指的是：寒假、暑假）
     */
    @ExcelIgnore
    private Integer isVacation;

    @ExcelIgnore
    private Integer isAutoScheduling;

    /**
     * （学期为：周几上课，如周一：1,周二：2,周三：3,周四：4,周五：5,周六：6,周日：0，多个逗号隔开)，（假期为：A天，B天）
     */
    @ExcelIgnore
    private String weekDates;

    /**
     * 排课类型，如：学期：A类，B类，假期：A天，B天
     */
    @ExcelIgnore
    private String schedulingType;


    /**
     * 教室id
     */
    @ExcelIgnore
    private Long classRoomId;

    /**
     * 状态
     */
    @ExcelIgnore
    private StatusGradeEnum status;

    /**
     * 是否封班，0否，1是
     */
    @ExcelIgnore
    private Integer isSeal;

    /**
     * 是否排课
     */
    @ExcelIgnore
    private Integer isScheduling;

    /**
     * 创建人id
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    private Long createdId;


    /**
     * 班主任id
     */
    @ExcelIgnore
    private Long classTeacherId;

    /**
     * 任课教师id
     */
    @ExcelIgnore
    private Long teacherId;

    @ExcelIgnore
    private Long schoolId;

    /**
     * deleted_at
     */
    @ExcelIgnore
    private LocalDateTime deletedAt;

    /**
     * 年份
     */
    @ExcelIgnore
    private Integer yearPart;

    @ExcelIgnore
    private Integer quarterNum;

    @ExcelIgnore
    private Integer isMakeup;

    @ExcelIgnore
    private String remark;

    /**
     * 助教教师id
     */
    @ExcelIgnore
    private Long helpTeacherId;

    @TableLogic
    @ExcelIgnore
    private Integer deleted;

    /**
     * created_at
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    /**
     * updated_at
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;


    @ExcelProperty(index = 3,value = "班主任")
    @TableField(exist = false)
    private String teacherName;

    @ExcelIgnore
    @TableField(exist = false)
    private List<TypeValueData> teacherList;

    /**
     * 课程
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Course courseObj;

    @ExcelIgnore
    @TableField(exist = false)
    private Staff teacherObj;

    @ExcelIgnore
    @TableField(exist = false)
    private Organization schoolObj;

    /**
     * 班级报读人数
     */
    @ExcelIgnore
    @TableField(exist = false)
    private Integer count;

    @ExcelIgnore
    @TableField(exist = false)
    private Integer advanceCount;


    @ExcelIgnore
    @TableField(exist = false)
    public Integer studentCount;

    @ExcelProperty(index = 2,value = "人数")
    @TableField(exist = false)
    private String studentNumber;

    @ExcelProperty(index = 8,value = "招生状态")
    @TableField(exist = false)
    private String enrollmentStatus;

    @ExcelProperty(index = 4,value = "所属课程")
    @TableField(exist = false)
    private String courseStr;

    @ExcelProperty(index = 9,value = "是否结班")
    @TableField(exist = false)
    private String finishStatus;

    @ExcelProperty(index = 5,value = "开班校区")
    @TableField(exist = false)
    private String schoolName;

    @ExcelProperty(index = 7,value = "排课状态")
    @TableField(exist = false)
    private String isSchedulingStr;


    @ExcelIgnore
    @TableField(exist = false)
    private Integer yearClassInt;

    @ExcelIgnore
    private Integer allowTimeClash;

    /**
     * 新加科目
     */
    @ExcelIgnore
    private Long subjectsId;


    /**
     * 转出班级id(记录转校时自动创建班级是否已经创建)
     */
    @ExcelIgnore
    private Long outId;

    /**
     * 转出校区详情id
     */
    @ExcelIgnore
    private Long changeSchoolDetailId;

    @ExcelIgnore
    @TableField(exist = false)
    private String className;

    @ExcelIgnore
    @TableField(exist = false)
    private String subjectsName;

    @ExcelIgnore
    private Integer positionNum;

    @ExcelIgnore
    private BigDecimal startScore;

    @ExcelIgnore
    private BigDecimal endScore;

    /**
     * 名额剩余
     */
    @ExcelIgnore
    @TableField(exist = false)
    private String residueCount;

    /**
     * 新生
     */
    @ExcelIgnore
    @TableField(exist = false)
    private String newStudentCount;

    /**
     * 老生
     */
    @ExcelIgnore
    @TableField(exist = false)
    private String oldStudentCount;

    @ExcelIgnore
    @TableField(exist = false)
    private String classTypeName;

    @ExcelIgnore
    @TableField(exist = false)
    private String classRoomName;

    @ExcelIgnore
    @TableField(exist = false)
    private String studentName;

    @ExcelIgnore
    @TableField(exist = false)
    private Long teamPid;

    @ExcelIgnore
    @TableField(exist = false)
    private Long teamId;

    @ExcelIgnore
    @TableField(exist = false)
    private String teamName;

    @ExcelIgnore
    @TableField(exist = false)
    private List<Grade> children;

    @ExcelIgnore
    @TableField(exist = false)
    private Long schoolPid;

    @ExcelIgnore
    private LocalDate finishDate;

    @ExcelIgnore
    private Integer isRebrush;

    @ExcelIgnore
    @TableField(exist = false)
    private String schoolTime;

    @ExcelIgnore
    @TableField(exist = false)
    private Long studentId;

    @ExcelIgnore
    @TableField(exist = false)
    private String[] studentIdList;

    @ExcelIgnore
    @TableField(exist = false)
    private Long inSchoolId;

    @ExcelIgnore
    @TableField(exist = false)
    private Long inTeacherId;

    @ExcelIgnore
    @TableField(exist = false)
    private String readingSchoolName;
}
